/*
 * @Author: TANGB02 13233582+Ace-Tang@user.noreply.gitee.com
 * @Date: 2024-01-21 00:16:20
 * @LastEditors: TANGB02 13233582+Ace-Tang@user.noreply.gitee.com
 * @LastEditTime: 2024-03-11 09:49:35
 * @FilePath: \ycq\ycq\ycq1.0\src\service\api.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { http } from "@/utils/request.js";
import qs from "qs";
const api = {
  login: "/user/login",
  register: "/user/register",
  updataPersonalMsg: "/user/updateIdentity",
  updataPwd: "/user/updatePassword",
  loginOut: "/user/logOut",
  getUserById: "/user/findById",
  getUsers: "/user/findAllUsers",
  updataStatus: "/user/updateStates",
  searchUsers: "/user/findUsers",
  getAdopt: "/adopt/getAdopt",
  deleteAdopt: "/adopt/deleteAdopt",
  appAdopt: "/adopt/mAddAdopt",
  updataAdopt: "/adopt/mUpdateAdopt",
  getAdoptById: "/adopt/mGetByNum",
  getAllApplication: "/adopt/getApp",
  addApplication: "/adopt/uAddApp",
  getApplicationRecords: "/adopt/getAppByUid",
  deleteRecords: "/adopt/mDeleteByNums",

  getAllAnimals: "/animal/queryAnimal",
  deleteAnimals: "/animal/deleteAnimal",
  updataAnimals: "/animal/updateAnimal",
  addAnimals: "/animal/addAnimal",
  getAnimalById: "/animal/getAnimalByNumber",
  updataApplication: "/adopt/mModifyApp",
  getAdopting: "/adopt/getAnimal",
  getAdopted: "/adopt/getAdopted",
  addReview: "/animal/postComment",
  getReviewByUserId: "/animal/getCommentByUserId",
  getReviewByAnimalNum: "/animal/getCommentByAnimalNumbers",
  updataReview: "/animal/updateComment",
  delReview: "/animal/deleteComment",
  // 图片
  upLoad: "/common/upload",
  download: "/common/download",
};
export const login = (data = {}) => {
  return http({
    url: api.login,
    method: "post",
    data,
  });
};
export const register = (data = {}) => {
  return http({
    url: api.register,
    method: "post",
    data,
  });
};
export const updataPersonalMsg = (data = {}) => {
  return http({
    url: api.updataPersonalMsg,
    method: "put",
    data,
  });
};
export const updataPwd = (data = {}) => {
  return http({
    url: api.updataPwd,
    method: "put",
    data,
  });
};
export const loginOut = (data = {}) => {
  return http({
    url: api.loginOut,
    method: "delete",
    data,
  });
};
export const getUserById = (params = {}) => {
  return http({
    url: api.getUserById,
    method: "get",
    params,
  });
};
export const getUsers = (params = {}) => {
  return http({
    url: api.getUsers,
    method: "get",
    params,
  });
};
export const updataStatus = (params = {}) => {
  return http({
    url: api.updataStatus,
    method: "put",
    params,
  });
};
export const searchUsers = (params = {}) => {
  return http({
    url: api.searchUsers,
    method: "get",
    params,
  });
};
export const getAdopt = (params = {}) => {
  return http({
    url: api.getAdopt,
    method: "get",
    params,
  });
};
export const deleteAdopt = (params = {}) => {
  return http({
    url: api.deleteAdopt,
    method: "delete",
    params,
  });
};
export const appAdopt = (data = {}) => {
  return http({
    url: api.appAdopt,
    method: "post",
    data,
  });
};
export const getAdoptById = (params = {}) => {
  return http({
    url: api.getAdoptById,
    method: "get",
    params,
  });
};
export const updataAdopt = (data = {}) => {
  return http({
    url: api.updataAdopt,
    method: "put",
    data,
  });
};
export const getAllApplication = (params = {}) => {
  return http({
    url: api.getAllApplication,
    method: "get",
    params,
  });
};
export const addApplication = (data = {}) => {
  return http({
    url: api.addApplication,
    method: "post",
    data,
  });
};
export const getApplicationRecords = (params = {}) => {
  return http({
    url: api.getApplicationRecords,
    method: "get",
    params,
  });
};
export const deleteRecords = (params = {}) => {
  return http({
    url: api.deleteRecords,
    method: "delete",
    params,
    paramsSerializer: (params) => {
      return qs.stringify(params, { indices: false });
    },
  });
};
export const getAllAnimals = (data = {}) => {
  return http({
    url: api.getAllAnimals,
    method: "post",
    data,
  });
};
export const deleteAnimals = (params = {}) => {
  return http({
    url: api.deleteAnimals,
    method: "delete",
    params,
  });
};
export const updataAnimals = (data = {}) => {
  return http({
    url: api.updataAnimals,
    method: "put",
    data,
  });
};
export const addAnimals = (data = {}) => {
  return http({
    url: api.addAnimals,
    method: "post",
    data,
  });
};
export const getAnimalById = (params = {}) => {
  return http({
    url: api.getAnimalById,
    method: "get",
    params,
  });
};
export const updataApplication = (data = {}) => {
  return http({
    url: api.updataApplication,
    method: "put",
    data,
  });
};
export const getAdopting = (params = {}) => {
  return http({
    url: api.getAdopting,
    method: "get",
    params,
  });
};
export const getAdopted = (params = {}) => {
  return http({
    url: api.getAdopted,
    method: "get",
    params,
  });
};
export const addReview = (data = {}) => {
  return http({
    url: api.addReview,
    method: "post",
    data,
  });
};
export const getReviewByUserId = (params = {}) => {
  return http({
    url: api.getReviewByUserId,
    method: "get",
    params,
  });
};
export const getReviewByAnimalNum = (params = {}) => {
  return http({
    url: api.getReviewByAnimalNum,
    method: "get",
    params,
  });
};
export const updataReview = (data = {}) => {
  return http({
    url: api.updataReview,
    method: "put",
    data,
  });
};
export const delReview = (params = {}) => {
  return http({
    url: api.delReview,

    method: "delete",
    params,
  });
};
//图片
export const upload = (data = {}) => {
  return http({
    url: api.upLoad,
    method: "POST",
    data,
  });
};
export const download = (params = {}) => {
  return http({
    url: api.download,
    method: "get",
    params,
    responseType: "arraybuffer",
  });
};
